/**
 * Copyright (C) 2009 Noel Ang
 *
 * This file is part of Samsara.
 *
 * Samsara is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Samsara is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Samsara.  If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/
package com.lunarshades.samsara.ui.actions;

import com.lunarshades.samsara.Raider;
import com.lunarshades.samsara.logging.Loggable;

/**
 * Represents a roster modification.
 *
 * @author Noel Ang, sparta.variable@gmail.com
 */
public abstract class RosterChangeEvent<T extends Raider> implements Loggable {

/**
 * Create a RosterChangeEvent.
 *
 * @param subject The subject of the change.
 * @param type    One of: {@link RosterChangeType#ADD}, {@link
 *                RosterChangeType#REMOVE}, {@link RosterChangeType#MODIFY}.
 *
 * @throws NullPointerException if subject is null.
 */
protected RosterChangeEvent(T subject, RosterChangeType type) {
    if (subject == null) {
        throw new NullPointerException("subject");
    }
    mSubject = subject;
    mType = type;
}

public T subject() {
    return mSubject;
}

public RosterChangeType type() {
    return mType;
}

/**
 * @return A representative message.
 */
public abstract Object message();

public static enum RosterChangeType {
    ADD, REMOVE, MODIFY
}

private final T mSubject;
private final RosterChangeType mType;
}
